Skip to content

feat: Add dedicated mode for UnslothService#577

Merged
vivekkalyan merged 16 commits intomainfrom
feat/dedicated-unsloth
Feb 24, 2026
Merged

feat: Add dedicated mode for UnslothService#577
vivekkalyan merged 16 commits intomainfrom
feat/dedicated-unsloth

Conversation

@vivekkalyan
Copy link
Collaborator

@vivekkalyan vivekkalyan commented Feb 23, 2026

Stacked on #578 (edit: now on main)

Summary

Adds a dedicated mode to UnslothService where training and inference run on separate GPUs. Training stays in-process on the trainer GPU(s); vLLM runs as a subprocess on the inference GPU. This eliminates the sleep/wake overhead of shared mode and enables true async overlap between training and inference.

Shared mode remains the default and is unchanged. Dedicated mode is opt-in via explicit GPU ID lists in _internal_config:

_internal_config = {
    "trainer_gpu_ids": [0],
    "inference_gpu_ids": [1],
}

Architecture

Shared Mode (unchanged):
  Single GPU timeshares training ↔ vLLM via sleep/wake

Dedicated Mode (new):
  Main process (GPU 0): Training (Unsloth + PEFT)
  Subprocess  (GPU 1): vLLM server (OpenAI-compatible API)
  Communication: HTTP only
  Adapter sync: disk checkpoint + /v1/load_lora_adapter (load_inplace=true)

What's included

  • Config contracts (dev/model.py, dev/validate.py): trainer_gpu_ids and inference_gpu_ids with validation (non-overlapping, contiguous from 0, single inference GPU for now)
  • vLLM subprocess entry point (vllm/dedicated_server.py): Applies ART patches, enables tool calling and runtime LoRA updates, then starts vLLM
  • Dedicated mode in UnslothService (unsloth/service.py): Subprocess lifecycle (start, health check, close), adapter reload via HTTP after each train step, no sleep/wake
  • LocalBackend routing (local/backend.py): Detects dedicated config, sets CUDA_VISIBLE_DEVICES before model init, routes to dedicated mode
  • Unit tests: Config validation + dedicated server arg building

Testing

Benchmark: ART-E to convergence with both Shared and Dedicated mode:

image

@vivekkalyan vivekkalyan force-pushed the feat/dedicated-unsloth branch 2 times, most recently from 51bda4d to 7c12d57 Compare February 24, 2026 00:30
@vivekkalyan vivekkalyan changed the base branch from main to fix/ci-failures February 24, 2026 00:30
@vivekkalyan vivekkalyan changed the title feat: Add dedicated unsloth feat: Add dedicated mode for UnslothService Feb 24, 2026
@vivekkalyan vivekkalyan force-pushed the feat/dedicated-unsloth branch 2 times, most recently from a92f9f3 to a5cfa22 Compare February 24, 2026 01:01
@vivekkalyan vivekkalyan changed the base branch from fix/ci-failures to main February 24, 2026 01:09
Copy link
Collaborator

@bradhilton bradhilton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vivekkalyan vivekkalyan merged commit 3990b66 into main Feb 24, 2026
2 checks passed
@vivekkalyan vivekkalyan deleted the feat/dedicated-unsloth branch February 24, 2026 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants